const { defineConfig } = require('@vue/cli-service')
// element-plus 按需导入
// const AutoImport = require('unplugin-auto-import/webpack')
// const Components = require('unplugin-vue-components/webpack')
// const { ElementPlusResolver } = require('unplugin-vue-components/resolvers')
module.exports = defineConfig({
  devServer: {
    proxy: {
      '/www': {
        target: 'https://www.12306.cn',
        changeOrigin: true,
        pathRewrite: {
          //这里可以理解成用‘/www’代替target里面的地址, 例如: 要调用’https://ebb.io/_/user/add’，直接写‘/www/user/add’即可，这样避免了跨域。
          '^/www': '',
        },
      },
      '/kyfw': {
        target: 'https://kyfw.12306.cn',
        changeOrigin: true,
        secure: false,
        pathRewrite: {
          '^/kyfw': '',
        },
      },
      '/api': {
        target: 'https://kyfw.12306.cn',
        changeOrigin: true,
        secure: false,
        pathRewrite: {
          '^/api': '',
        },
      },
      '/qy': {
        target: 'https://qyapi.weixin.qq.com',
        changeOrigin: true,
        secure: false,
        // pathRewrite: {
        //   '^/qy': '',
        // },
      }
    }
  },
  lintOnSave: undefined,
  // configureWebpack: {
  // // element-plus 按需导入
  //   plugins: [
  //     AutoImport({
  //       resolvers: [ElementPlusResolver()],
  //     }),
  //     Components({
  //       resolvers: [ElementPlusResolver()],
  //     }),
  //   ],
  // }
})



